package com.example.cd5160866.urlapp.utils;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;

import com.example.cd5160866.urlapp.R;

/**
 * Created by cd5160866 on 2017/2/7.
 */

public class UiStandardUtils {


    public static Drawable getShap(Context context, int color, boolean isHollow) {
        int roundRadius = (int) context.getResources().getDimension(R.dimen.btn_radius_normal);
        int strokeWidth = (int) context.getResources().getDimension(R.dimen.btn_stroke_width);
        int colors[] = {0xFFFFFF, 0xFFFFFF};
        GradientDrawable drawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors);//创建drawable
        drawable.setColor(isHollow ? Color.TRANSPARENT : color);
        drawable.setCornerRadius(roundRadius);
        drawable.setStroke(strokeWidth, color);
        return drawable;
    }
}
